import React, { Component } from 'react'
// withRouter就是一个高阶组件
import { withRouter } from 'react-router-dom'

class NewsDetail extends Component {
  componentDidMount () {
    console.log(this.props.location.search)
    const searchParams = new URLSearchParams(this.props.location.search)
    const id = searchParams.get('id')
    const name = searchParams.get('name')
    // this.$route.query.id = id
    // this.$route.query.name = name
    console.log(id, name)
  }

  render () {
    return <div>NewsDetail</div>
  }
}

export default withRouter(NewsDetail)
